new Vue({
	el: '#app',
	extends: isLogin,
	data: {
		state:1,//控制显示模态框的状态
		CompanyInfo: '', //公司信息
		CompanyIntelligence:'',//企业资质栏目
		overCredentialNum:"",//4个月过期的数量
		PersonCredential:'',//个人证书栏目
		OfficeWorkList:'',//办事结果
		personList:'',//个人证书列表
		ComIntelligenceDet:'',//企业资质详情
	},
	methods: {
		//header组件的搜索方法
		searchHeader: function(searchCtx) {

		},
		//获取公司信息
		getCompanyInfo:function() {
			var _this = this;
			var method = 'DashBoard/GetCompanyInfo';
			var param = {
				PageSize: 4,
			};
			xq.getUrl(method, param, function(res) {
				if(res.data) {
					var data = res.data;
					if(data.Logo) {
						data.Logo = xq.httpUrl + data.Logo;
					}
					if(data.ExpireCertificateList){
						_this.overCredentialNum = data.ExpireCertificateList.length;
					}
					_this.CompanyInfo = data;
				}
			})
		},
		//企业资质栏目
		getCompanyIntelligence:function() {
			var _this = this;
			var method = 'DashBoard/GetEnterpriseCertificatesExpireDays';
			var param = {};
			xq.getUrl(method, param, function(res) {
				if(res.data) {
					var data = res.data;
					for(var i = 0;i<data.length;i++){
						if(data[i].QC_ExpireDays<0){
							data[i].QC_ExpireDays = '已过期';
						}
					}
					_this.CompanyIntelligence = data;
				}
			})
		},
		//个人证书栏目
		getPersonCredential:function() {
			var _this = this;
			var method = 'DashBoard/GetPersonalCertificatesExpireDays';
			var param = {};
			xq.getUrl(method, param, function(res) {
				if(res.data) {
					var data = res.data;
					_this.PersonCredential = data;
				}
			})
		},
		//办事结果栏目
		getOfficeWorkList:function() {
			var _this = this;
			var method = 'DashBoard/GetOfficeWorkList';
			var param = {};
			xq.getUrl(method, param, function(res) {
				if(res.data) {
					var data = res.data;
					_this.OfficeWorkList = data;
				}
			});
		},
		//打开企业详情证书弹窗
		openCM:function(index){
			this.state = 3;
			var _this = this;
			var data = this.CompanyIntelligence[index];
			switch(parseInt(data.QC_Code)){
				case 01:
					data.QC_Code = '建筑业企业';
					break;
				case 02:
					data.QC_Code = '工程勘察';
					break;
				case 08:
					data.QC_Code = '工程设计';
					break;
				case 09:
					data.QC_Code = '工程设计与施工';
					break;
				case 11:
					data.QC_Code = '房地产开发';
					break;
				case 21:
					data.QC_Code = '城市园林';
					break;
			}
			this.ComIntelligenceDet = data;
		},
		//打开个人证书弹窗
		openPM:function(CategoryID){
			this.state = 2;
			var _this = this;
			var method = 'DashBoard/GetPersonalCertificatesList';
			var param = {
				CategoryID:CategoryID,
			};
			xq.getUrl(method, param, function(res) {
				if(res.data) {
					var data = res.data;
					_this.personList = data;
				}
			});
		},
		//关闭个人证书弹窗
		closeModal:function(){
			this.state = 1;
		},
	},
	mounted: function() {
		this.getCompanyInfo();
		this.getCompanyIntelligence();
		this.getPersonCredential();
		this.getOfficeWorkList();
		xq.confitAnimate();
	},
	updated: function() {

	}
})